import cv2
import numpy as np
if __name__ == '__main__':
    image=cv2.imread("C:\\Users\\20436\Desktop\hongtou.jpg")
    points=np.float32([[56,22],[413,118],[41,664],[497,599]])
    copy_image=image.copy()
    img_shape=image.shape
    points1=np.float32([[0,0],[img_shape[1],0],[0,img_shape[0]],[img_shape[1],img_shape[0]]])
    M=cv2.getPerspectiveTransform(
        points,
        points1
    )
    correct_image=cv2.warpPerspective(
        image,
        M,
        (img_shape[1],img_shape[0] ),
         cv2.INTER_LINEAR,
         cv2.BORDER_WRAP
    )


    cv2.imshow('correct_image',correct_image)
    cv2.imwrite('correct_image.jpg',correct_image)
    cv2.waitKey(0)





